/* 权限检查页面样式 */
.permission-denied {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #344767 0%, #764ba2 100%);
  padding: 20px;
}

.permission-content {
  background: white;
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  max-width: 400px;
  width: 100%;
}

.permission-icon {
  font-size: 64px;
  margin-bottom: 24px;
  opacity: 0.8;
}

.permission-title {
  font-size: 28px;
  font-weight: 600;
  color: #333;
  margin: 0 0 16px 0;
}

.permission-message {
  font-size: 16px;
  color: #666;
  margin: 0 0 32px 0;
  line-height: 1.5;
}

.permission-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.permission-actions .ant-btn {
  height: 44px;
  padding: 0 24px;
  font-size: 16px;
  border-radius: 8px;
  font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .permission-content {
    padding: 40px 24px;
    margin: 0 16px;
  }

  .permission-icon {
    font-size: 48px;
  }

  .permission-title {
    font-size: 24px;
  }

  .permission-actions {
    flex-direction: column;
  }

  .permission-actions .ant-btn {
    width: 100%;
  }
}

.add-page {
  padding: 20px;
  height: calc(100vh - 120px);
  overflow: hidden;
}

.add-page-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.add-page-title {
  font-size: 24px;
  font-weight: 600;
  color: #1a1a1a;
}

.add-page-content {
  display: flex;
  gap: 24px;
  height: calc(100% - 60px);
}

.add-page-form {
  width: 750px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 12px;
  overflow-y: scroll;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.add-page-form-item {
  margin-bottom: 10px;
  position: relative;
}

.add-page-form-label {
  display: block;
  font-size: 14px;
  color: #4a5568;
  margin-bottom: 8px;
}

.add-page-form-input,
.add-page-form-textarea,
.add-page-form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  color: #1a1a1a;
  transition: all 0.3s;
}

.add-page-form-input:focus,
.add-page-form-textarea:focus,
.add-page-form-select:focus {
  border-color: #344767;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
  outline: none;
}

.add-page-form-textarea {
  height: 100px;
  resize: none;
}

.add-page-form-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.add-page-form-tag {
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  color: #4a5568;
  background: #f7fafc;
  cursor: pointer;
  transition: all 0.3s;
}

.add-page-form-tag:hover {
  background: #edf2f7;
}

.add-page-form-tag.is-active {
  background: #344767;
  color: #fff;
}

.add-page-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.add-page-editor,
.add-page-chart {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.add-page-editor-header,
.add-page-chart-header {
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 58px;
  box-sizing: border-box;
}

.add-page-editor-title,
.add-page-chart-title {
  font-size: 14px;
  font-weight: 500;
  color: #4a5568;
}

.add-page-chart-run {
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 14px;
  color: #fff;
  background: #344767;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
}

.add-page-chart-run:hover {
  background: #344767;
}

.add-page-editor-content,
.add-page-chart-content {
  flex: 1;
  overflow: hidden;
  margin-top: 10px;
}

.chart-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 4px;
  margin-top: 4px;
}

.chart-type-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chart-type-item:hover {
  background: #edf2f7;
  transform: translateY(-1px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.chart-type-item.is-active {
  background: #ebf5ff;
  border-color: #344767;
  color: #344767;
}

.chart-type-item i {
  font-size: 14px;
  margin-bottom: 2px;
}

.chart-type-label {
  font-size: 11px;
  text-align: center;
  color: inherit;
  line-height: 1;
}

.chart-select {
  position: relative;
  width: 100%;
}

.chart-select .error-tip {
  bottom: -18px;
}

.chart-select-input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  user-select: none;
}

.chart-select-input:hover {
  border-color: #344767;
  background: #f8fafc;
}

.chart-select-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-select-label:empty::before {
  content: '请选择图表类型';
  color: #94a3b8;
}

.chart-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 1000;
  border: 1px solid #e2e8f0;
  padding: 4px;
  max-height: 300px;
  overflow-y: auto;
}

.chart-select-option {
  height: 36px;
  padding: 0 8px;
  margin: 2px 0;
  display: flex;
  align-items: center;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
  font-size: 13px;
  color: #475569;
}

.chart-select-option:hover {
  background: #eff6ff;
  color: #344767;
}

.chart-select-option:hover .chart-select-icon {
  color: #344767;
}

.chart-select-option.is-active {
  background: #eff6ff;
  color: #344767;
  font-weight: 500;
}

.chart-select-option.is-active .chart-select-icon {
  color: #344767;
}

.chart-select-icon {
  width: 16px;
  margin-right: 8px;
  font-size: 14px;
  color: #64748b;
}

.chart-select-option:hover .chart-select-icon {
  color: #344767;
}

.chart-select-option.is-active .chart-select-icon {
  color: #344767;
}

.chart-select-arrow {
  width: 16px;
  height: 16px;
  margin-left: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.chart-select-arrow::after {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
}

.chart-select[aria-expanded='true'] .chart-select-arrow {
  transform: rotate(180deg);
}

.chart-select-input:hover .chart-select-arrow {
  color: #344767;
}

/* 滚动条样式 */
.chart-select-dropdown::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.chart-select-dropdown::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: #e2e8f0;
}

.chart-select-dropdown::-webkit-scrollbar-track {
  border-radius: 3px;
  background: #f8fafc;
}

.chart-select-dropdown::-webkit-scrollbar-corner {
  background: transparent;
}

/* 动画 */
.slide-fade-enter-active,
.slide-fade-leave-active {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-fade-enter-from,
.slide-fade-leave-to {
  transform: translateY(4px);
  opacity: 0;
}

.required-mark {
  color: #f56c6c;
  margin-left: 4px;
  font-size: 14px;
}

.error-tip {
  position: absolute;
  left: 0;
  bottom: -18px;
  font-size: 12px;
  color: #f56c6c;
  line-height: 1;
  z-index: 1;
}

.add-page-form-input.is-error,
.add-page-form-textarea.is-error,
.chart-select-input.is-error {
  border-color: #f56c6c;
}

.add-page-form-input.is-error:hover,
.add-page-form-textarea.is-error:hover,
.chart-select-input.is-error:hover {
  border-color: #f56c6c;
}

.add-page-form-input.is-error:focus,
.add-page-form-textarea.is-error:focus {
  border-color: #f56c6c;
  box-shadow: 0 0 0 2px rgba(245, 108, 108, 0.1);
}

.add-page-submit {
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 13px;
  color: #fff;
  background: #344767;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.add-page-submit:hover {
  background: #344767;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.add-page-submit:active {
  transform: translateY(0);
  box-shadow: none;
}

.form-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.editor-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.code-error-tip {
  position: relative;
  top: 0;
  right: 0;
  padding: 4px 8px;
  background: rgba(254, 242, 242, 0.98);
  color: #dc2626;
  font-size: 12px;
  border: 1px solid #fecaca;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  max-width: none;
  margin-left: 4px;
}

.code-error-icon {
  flex-shrink: 0;
  font-size: 14px;
  margin-top: 1px;
}

.code-error-message {
  flex: 1;
  line-height: 1.4;
  font-family: Consolas, Monaco, monospace;
  word-break: break-word;
  white-space: normal;
}

.code-error-close {
  flex-shrink: 0;
  font-size: 16px;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 50%;
  color: #ef4444;
  transition: all 0.2s;
  cursor: pointer;
  margin: -2px -4px 0 0;
}

.code-error-close:hover {
  background: #fee2e2;
}

/* 修改动画效果 */
.fade-enter-active,
.fade-leave-active {
  transition: all 0.2s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
  transform: translateX(-10px);
}

.add-page-editor {
  position: relative;
  display: flex;
  flex-direction: column;
}

.add-page-editor-content {
  flex: 1;
  position: relative;
}

/* 消息提示 */
.message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  padding: 10px 20px;
  border-radius: 4px;
  color: #fff;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease-in-out;
}

.message-show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.message-success {
  background-color: #67c23a;
}

.message-error {
  background-color: #f56c6c;
}

/* 加载中遮罩 */
.loading-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.loading-show {
  opacity: 1;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  margin-top: 10px;
  color: #fff;
  font-size: 14px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
